//
//  FJYShow.m
//  T
//
//  Created by 方菁云 on 16/2/22.
//  Copyright © 2016年 FJY. All rights reserved.
//

#import "FJYShow.h"
#import "BaseHeader.h"


@implementation FJYShow


#pragma mark -------------- view change --------------

+ (void)waterDropCATransitionWithView:(UIView *)view dration:(CGFloat)dration {
    
    CATransition *transition = [CATransition animation];
    transition.type = @"rippleEffect";
    transition.subtype = kCATransitionFromLeft;
    transition.duration = dration;
    [view.superview.layer addAnimation:transition forKey:@"水滴效果"];
}


#pragma mark ---------- alert show -----------

+ (UIAlertController *)noContext {
    UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"提示" message:@"添加的事件不能为空" preferredStyle:(UIAlertControllerStyleAlert)];
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:@"确定" style:(UIAlertActionStyleDefault) handler:nil];
    [alertC addAction:sureAction];
    return alertC;
}


#pragma mark ---------- animation -----------

+ (void)cloudShowWithCloud:(UIImageView *)cloud {
    [UIView animateWithDuration:0.1 animations:^{
        
        if (cloud.frame.origin.x >= kWidth) {
            cloud.hidden = YES;
            cloud.alpha = 0;
            cloud.transform = CGAffineTransformMakeTranslation(- cloud.frame.size.width, arc4random() % 300);
        } else {
            cloud.hidden = NO;
            cloud.alpha = 1;
            cloud.transform = CGAffineTransformMakeTranslation(cloud.frame.origin.x + 0.5, 0);
        }
    } completion:nil];
    
}


+ (void)cellTurnWithTableView:(UITableView *)tableView indexPath:(NSIndexPath *)indexPath {
    [UIView beginAnimations:@"animation" context:nil];
    [UIView setAnimationDuration:0.5f];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
    [UIView setAnimationRepeatAutoreverses:NO];
    [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:[tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:indexPath.row inSection:0]] cache:NO];
    [UIView commitAnimations];
}

+ (void)animationWithCell:(UITableViewCell *)cell {

    cell.transform = CGAffineTransformMakeScale(1, 1.4);
    [UIView animateWithDuration:2 animations:^{
        cell.transform = CGAffineTransformMakeScale(1, 1);
    } completion:nil];
}

@end
